<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改车辆')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-vehicle-edit" th:object="${sysAssetsVehicle}">
            <input name="id" th:field="*{id}" type="hidden">
            <input name="uid"  type="hidden"  th:field="*{uid}" id="treeId"/>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">车牌号：</label>
                <div class="col-sm-8">
                    <input name="carno" th:field="*{carno}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">车辆分类：</label>
                <div class="col-sm-8">
                    <select name="vehiclecategory" class="form-control m-b" th:with="type=${@dict.getType('vehicle_category')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{vehiclecategory}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">所属项目：</label>
                <div class="col-sm-8">
                    <input name="projectname" th:field="*{projectname}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">级别：</label>
                <div class="col-sm-8">
                    <select name="level" class="form-control m-b" th:with="type=${@dict.getType('vehicle_level')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{level}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">车架号：</label>
                <div class="col-sm-8">
                    <input name="vinno" th:field="*{vinno}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">发动机号：</label>
                <div class="col-sm-8">
                    <input name="enginesn" th:field="*{enginesn}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">规格型号：</label>
                <div class="col-sm-8">
                    <input name="vehiclemodel" th:field="*{vehiclemodel}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">发动机型号：</label>
                <div class="col-sm-8">
                    <input name="enginemodel" th:field="*{enginemodel}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">所属公司：</label>
                <div class="col-sm-8">
                    <input name="companyname" th:field="*{companyname}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">登记证编号：</label>
                <div class="col-sm-8">
                    <input name="registerno" th:field="*{registerno}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">购买日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="purchasedate" th:value="${#dates.format(sysAssetsVehicle.purchasedate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">购买车辆费用：</label>
                <div class="col-sm-8">
                    <input name="purchasecost" th:field="*{purchasecost}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">排放标准：</label>
                <div class="col-sm-8">
                    <select name="caremission" class="form-control m-b" th:with="type=${@dict.getType('vehicle_emission')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{caremission}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">车牌颜色：</label>
                <div class="col-sm-8">
                    <select name="platecolor" class="form-control m-b" th:with="type=${@dict.getType('vehicle_platecolor')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{platecolor}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">燃料：</label>
                <div class="col-sm-8">
                    <select name="fuel" class="form-control m-b" th:with="type=${@dict.getType('vehicle_fuel')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{fuel}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">轮胎数量：</label>
                <div class="col-sm-8">
                    <input name="tyrecount" th:field="*{tyrecount}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">轮胎规格：</label>
                <div class="col-sm-8">
                    <select name="tyretype" class="form-control m-b" th:with="type=${@dict.getType('vehicle_tyre_size')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{tyretype}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">车身颜色：</label>
                <div class="col-sm-8">
                    <input name="carcolor" th:field="*{carcolor}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">车辆轴数：</label>
                <div class="col-sm-8">
                    <input name="vehicleaxlecount" th:field="*{vehicleaxlecount}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">车辆长度cm：</label>
                <div class="col-sm-8">
                    <input name="vehiclelength" th:field="*{vehiclelength}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">车辆宽度cm：</label>
                <div class="col-sm-8">
                    <input name="vehiclewidth" th:field="*{vehiclewidth}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">车辆重量kg：</label>
                <div class="col-sm-8">
                    <input name="vehicleweight" th:field="*{vehicleweight}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">核载重量kg：</label>
                <div class="col-sm-8">
                    <input name="vehicledeadweight" th:field="*{vehicledeadweight}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">载客人数：</label>
                <div class="col-sm-8">
                    <input name="vehiclepassengercount" th:field="*{vehiclepassengercount}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">行驶证编号：</label>
                <div class="col-sm-8">
                    <input name="vehiclelicense" th:field="*{vehiclelicense}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">车辆品牌：</label>
                <div class="col-sm-8">
                    <input name="vehiclebrand" th:field="*{vehiclebrand}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">车辆轴距：</label>
                <div class="col-sm-8">
                    <input name="vehiclewheelbase" th:field="*{vehiclewheelbase}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">生产厂家：</label>
                <div class="col-sm-8">
                    <input name="vehicleproducer" th:field="*{vehicleproducer}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">报废日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="vehiclescrappingdate" th:value="${#dates.format(sysAssetsVehicle.vehiclescrappingdate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">年审月份：</label>
                <div class="col-sm-8">
                    <select name="vehiclereviewmonth" class="form-control m-b" th:with="type=${@dict.getType('year_of_month')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{vehiclereviewmonth}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">租赁开始日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="vehicleleasestartdate" th:value="${#dates.format(sysAssetsVehicle.vehicleleasestartdate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">租赁截止日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="vehicleleaseenddate" th:value="${#dates.format(sysAssetsVehicle.vehicleleaseenddate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">押金|转让金：</label>
                <div class="col-sm-8">
                    <input name="deposit" th:field="*{deposit}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">每月租金：</label>
                <div class="col-sm-8">
                    <input name="monthrent" th:field="*{monthrent}" class="form-control" type="text">
                </div>
            </div>

            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">车辆状态：</label>
                <div class="col-sm-8">
                    <select name="status" class="form-control m-b" th:with="type=${@dict.getType('vehicle_status')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{status}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">已行驶公里数km：</label>
                <div class="col-sm-8">
                    <input name="mileage" th:field="*{mileage}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label  is-required">使用者：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input class="form-control" type="text" name="users" onclick="selectUsersTree()" id="treeName" th:field="*{users}" required>
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">使用者id：</label>
                <div class="col-sm-8">
                    <input name="uid" class="form-control" th:field="*{uid}" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <input name="remarks" class="form-control"  th:field="*{remarks}" type="text" >
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "system/vehicle";
        $("#form-vehicle-edit").validate({
            focusCleanup: true
        });

        function selectUsersTree() {
            var uid = $.common.isEmpty($("#treeId").val()) ? "1" : $("#treeId").val();
            var url = ctx + "system/user/selectUsersTree/" + uid;
            var options = {
                title: '选择用户',
                width: "800",
                url: url,
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
            $("#treeId").val(body.find('#treeId').val());
            $("#treeName").val(body.find('#treeName').val());
            layer.close(index);
        }

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-vehicle-edit').serialize());
            }
        }

        $("input[name='purchasedate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='vehiclescrappingdate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='vehicleleasestartdate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='vehicleleaseenddate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>